<?php

class Adept_Db_ColumnInfo 
{

    const STRING = 'string';
    const TEXT = 'text';
    const INTEGER = 'integer';
    const FLOAT = 'float';
    const BOOLEAN = 'boolean';
    const DATE = 'date';
    const TIME = 'time';
    const DATETIME = 'datetime';
    const TIMESTAMP = 'timestamp';
    const BLOB = 'blob';

    protected function retriveMetaType($type) 
    {

        static $typeMap = array(
            self::STRING => array('varchar', 'char', 'string', 'nchar', 'enum',
            'charaster', 'interval'),
            self::INTEGER => array('integer', 'int', 'long', 'bigint'),
            self::TEXT => array('longchar', 'text', 'memo'),
            self::BLOB => array('blob', 'image', 'binary'),
            self::BOOLEAN => array('boolean', 'logical'),
            self::DATE => array('date', 'year'),
            self::TIME => array('time'),
            self::TIMESTAMP => array('timestamp'),
            self::DATETIME => array('datetime'),
            self::FLOAT => array('float', 'real', 'double', 'decimal', 'currency', 'money', 'numeric'),
        );


        $type = strtolower($type);

        foreach ($typeMap as $metaType => $variants) {
            if (in_array($type, $variants)) {
                return $metaType;
            }
        }

        return false;
    }

}
